<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ko">
<head>
	<title>관리자관리 - 중앙선거관리위원회 사이버선거역사관</title>
	<script src="../js/jquery.js" type="text/javascript"></script>
	<script type="text/javascript">
		
		// 페이지 이동
		function setPage(page)
		{
			var frm = document.forms["listMap"];
			frm.action = "/bbs/${ bbsMap.BBS_ID }_list.do";
			frm.page.value = page;
			frm.submit();
		}
		
		function downloadFileBtn(file_id, file_job_id)
		{
			location.href='/common/download.do?fileid=' + file_id + '&jobid=' + file_job_id;
		}
		
		function deleteFileBtn(id)
		{
			if(!checkAuth()) return false;
			if (confirm("정말로 삭제하시겠습니까?"))
		  	{	
				var frm = document.forms["deleteFrm"];
				frm.article_id.value = id;
				frm.submit();
				
				return true;
			}    		
		}
	</script>
</head>

<body>
		<form id="listMap" name="listMap" method="get">
		<input type="hidden" name="page" value="1" />
		<input type="hidden" name="conditions" value="${commandMap.conditions}" />
		<input type="hidden" name="words" value="${commandMap.words}" />
		</form>
		<!-- 본문 영역 -->
		<div id="contents">
			<!-- 제목 및 Location 영역 -->
			<div id="location">
				<h3 id="contentTitle"></h3>
				<div id="locationPath"></div>
			</div>
			<script type="text/javascript">
			// 현재 메뉴 경로를 설정한다.
			var pagePath = licationPth.split("_");
			var pathStr = "홈";
			for( var i=0; i < pagePath.length; i++ )
			{
				if (i+1 >= pagePath.length)
					pathStr += " &gt; <strong>" + pagePath[i] + "</strong>";
				else
					pathStr += " &gt; " + pagePath[i]
			}
			document.getElementById("contentTitle").innerHTML = pagePath[ pagePath.length - 1 ];
			document.getElementById("locationPath").innerHTML = pathStr;
			</script>
			<!-- 본문 내용 -->
			<div id="content">
				<div class="boxType01">
					<form name="searchFrm" method="get" action="../bbs/${ bbsMap.BBS_ID }_list.do" >
					<div class="cont ar">
						<select title="검색 조건 선택" name="conditions">
							<option value="article_title">제목</option>
						</select>
						<input type="text" name="words" size="25" />
						<span class="button btnProc04"><input type="submit" value="검색" onclick="searchFnc();"/></span>
					</div>
					</form>
					<form name="deleteFrm" method="post" action="../bbs/${ bbsMap.BBS_ID }_proc.do">
					<input type="hidden" name="mode" value="delete" />
					<input type="hidden" name="bbs_id" value="${bbsMap.BBS_ID}" />
					<input type="hidden" name="article_id" />
					<input type="hidden" name="article_editor" id="article_editor" value="${ adminInfo.admin_name }" />
					<input type="hidden" name="article_editor_id" id="article_editor_id" value="${ adminInfo.admin_id }" />
					</form>
				</div>
				<div class="t20"></div>
				<ul class="imgList">
					<c:forEach var="listMap" items="${listMap2}">
					<li style="float:left; padding:0 25px 20px;">
						<div>
							<a href="${ bbsMap.BBS_ID }_view.do?article_id=${listMap.ARTICLE_ID}">
								<c:choose>
									<c:when test="${listMap.FILE_YN eq '0'}">
										<img alt="이미지" src="/images/common/noimage.gif" style="width:148px;height:148px;" />
									</c:when>
									<c:otherwise>
										<img alt="이미지" src="${host_name}${listMap.FILE_NAME}" style="width:148px;height:148px;" />
									</c:otherwise>
								</c:choose>
							</a>
						</div>
						<p><a href="#" class="fcB">
						<c:if test="${fn:length(listMap.ARTICLE_TITLE) > 18}">
					    <c:out value="${fn:substring(listMap.ARTICLE_TITLE,0,15)}" />...                    
						</c:if>
						<c:if test="${fn:length(listMap.ARTICLE_TITLE) <= 18}">
						    ${listMap.ARTICLE_TITLE}
						 </c:if>
						</a></p>				
						<p>${ listMap.ARTICLE_WRITE_DATE }</p>
						<div>
							<span class="button btnProc01"><a href="${ bbsMap.BBS_ID }_edit.do?article_id=${listMap.ARTICLE_ID}" >수정</a></span>
							<span class="button btnProc01"><a onclick="deleteFileBtn('${listMap.ARTICLE_ID}')">삭제</a></span>
						</div>
					</li>
					</c:forEach>
				</ul>
				<div class="cb"><hr></div>
				<div class="ar mt15"><span class="button btnProc01"><a onclick="checkAuth('../bbs/${ bbsMap.BBS_ID }_write.do');">글쓰기</a></span></div>
				<%@include file="/include/pageList.jsp"%>
			</div>
		</div>
</body>
</html>